using System;
using System.Collections.Generic;
using System.Text;
using GuavaData;


namespace CORIDemo
{
    [GuavaLib.Channel()]
    public class AppChannel
    {
        [GuavaLib.Channel()]
        public static Channel GetChannel()
        {

            Channel c = new Channel();
            /*
            List<String> tabs7 = new List<string>();
            List<String> atts7 = new List<string>();
            List<String> vals7 = new List<string>();
            tabs7.Add("find_text");
            atts7.Add("item");
            vals7.Add("textval");
            Unpivot up7 = new Unpivot(tabs7, atts7, vals7);
            c.Add(up7); 
            
            List<String> tabs6 = new List<string>();
            List<String> atts6 = new List<string>();
            List<String> vals6 = new List<string>();
            tabs6.Add("find_strn");
            atts6.Add("item");
            vals6.Add("stringval");
            Unpivot up6 = new Unpivot(tabs6, atts6, vals6);
            c.Add(up6);
            
            List<String> tabs5 = new List<string>();
            List<String> atts5 = new List<string>();
            List<String> vals5 = new List<string>();
            tabs5.Add("find_data");
            atts5.Add("item");
            vals5.Add("numericval");
            Unpivot up5 = new Unpivot(tabs5, atts5, vals5);
            c.Add(up5);*/
            /*
            List<String> tabs4 = new List<string>();
            List<String> atts4 = new List<string>();
            List<String> vals4 = new List<string>();
            tabs4.Add("proc_real");
            atts4.Add("item");
            vals4.Add("textval");
            Unpivot up4 = new Unpivot(tabs4, atts4, vals4);
            c.Add(up4);
            */
            
            List<String> tabs2 = new List<string>();
            List<String> atts2 = new List<string>();
            List<String> vals2 = new List<string>();
            tabs2.Add("proc_strn");
            atts2.Add("item");
            vals2.Add("stringval");
            Unpivot up2 = new Unpivot(tabs2, atts2, vals2);
            c.Add(up2);
          /*  
            List<String> tabs3 = new List<string>();
            List<String> atts3 = new List<string>();
            List<String> vals3 = new List<string>();
            tabs3.Add("proc_text");
            atts3.Add("item");
            vals3.Add("textval");
            Unpivot up3 = new Unpivot(tabs3, atts3, vals3);
            c.Add(up3);*/

            List<String> tabs = new List<string>();
            List<String> atts = new List<string>();
            List<String> vals = new List<string>();
            tabs.Add("proc_data");
            atts.Add("item");
            vals.Add("numericval");
            Unpivot up = new Unpivot(tabs, atts, vals);
            c.Add(up);

            //"cbDivertDx", 
            List<string> toSplitFindText = new List<string>();
            toSplitFindText.AddRange(new string[] { "cbStartLoc", "cbEndLoc", "comments", "tbPolypComments" });
            VSplit vsp7 = new VSplit("find_text", "find_other", toSplitFindText);
            c.Add(vsp7);

            List<string> toSplitFindStrnt = new List<string>();
            toSplitFindStrnt.AddRange(new string[] {  "bleedRate", "cbPolypDx", "cbPolypRemoved", 
                "raPolypTissRetrieved" });
            VSplit vsp6 = new VSplit("find_strn", "find_text", toSplitFindStrnt);
            c.Add(vsp6);
            
            List<string> toSplitFindTinyInt = new List<string>();
            toSplitFindTinyInt.AddRange(new string[] { "nonHem", "hem", "diverticulitis", 
                "imageTaken", "cfPolypDiminutive", "nbPolypSize", "cfPolypHemostatic", 
                "cfPolypTherNonHemo", "cfPolypImagesTaken", "cfPolypBiopWOCautery",
                "cfPolypBiopWCautery", "cfPolypSnaerWOCautery", "cbPolypSnareWCautery", 
                "cfPolypSnareWSaline", "cfPolypTattoo" });
            VSplit vsp5 = new VSplit("find_data", "find_strn", toSplitFindTinyInt);
            c.Add(vsp5);

            VMerge vm22 = new VMerge("find_data", "TherapyNonHemostatic");
            c.Add(vm22);

            VMerge vm21 = new VMerge("find_data", "TherapyHemostatic");
            c.Add(vm21);

            List<string> toMerge2 = new List<string>();
            toMerge2.Add("Diverticulosis");
            toMerge2.Add("Polyp");
            HMerge h2 = new HMerge(toMerge2, "find_data", "findType");
            c.Add(h2);

            List<string> toSplitReal = new List<string>();
            toSplitReal.AddRange(new string[] { "tbPrepDose" });
            VSplit vsp4 = new VSplit("proc_real", "proc_other", toSplitReal);
            c.Add(vsp4);
            
            List<string> toSplitString = new List<string>();
            toSplitString.AddRange(new string[] { "aspirin", "antiinflamCoag", "nsaid", "lmwh", "plavix", 
                "cox2", "heparin", "coumadin", "smoking", "alcohol", "lab", "allergy", "AbdominalExamWNL",
                "HEENTExamWNL", "MentalStatusExamWNL", "NeurologicalExamWNL", "CardioPulmonaryExamWNL",
                "ExtremityExamWNL", "varices", "priorBld", "bldStatus",
                "priorSurv", "priorMonth", "cbPriorYear", "encephalopathy", "ascites", "bilirubin", 
                "albumin", "pt", "raCDifficileColitis", "raChronsDisease", "raGraftHostDisease", 
                "raInfectiousColitis", "raIschemicColitis", "raRadiationColitis", "raUlcerativeColitis",
                "raConsentObtained", "cbPersonConsenting", "cbConsentObBy", "raPatAdminStatus", 
                "cbEndoscopyPerformedIn", "cbConsentForResearch", "cbRespEndoscopist", "cbPrepUsed", 
                 "cbASAAssesedBy", "raProcCompleted", 
                "cbProcQualBowelPrep", "cbProcIntended", "cbProcActReached", "raProcImages", 
                "raProcFlouroscopy", "cbProcPatientPos", "raABComp", "cbProcTolerance", "cbProcAftProcSent", 
                "cbProcAftRecoverySent"});
            VSplit vsp3 = new VSplit("proc_strn", "proc_real", toSplitString);
            c.Add(vsp3);

            List<string> toSplitText = new List<string>();
            toSplitText.AddRange(new string[] {"cbASAClass","cbLevelOfSedation", "cbSedManagedBy", "tbAntiCoagPlan", "tbOtherAntiMeds", "medsOtherTxt", 
                "labTxt", "allergyTxt", "comments", "PEComments", "childspughClass", "bldComments", 
                "tbIndComments", "tbPreprocComments", "tbProcComments" });
            VSplit vsp2 = new VSplit("proc_text", "proc_strn", toSplitText);
            c.Add(vsp2);

            List<string> toSplitTinyInt = new List<string>();
            toSplitTinyInt.AddRange(new string[] { "Systolic", "Diastolic", "EntireExamWNL", "bilBypass",
                "cystRemoval", "lobectomy", "Height", "Weight", "cfNoPriSurg", "surgHx", "cfNoHistOfMEdIll",
                "medHx", "Pulse", "noPacks", "noYears", "esophageal", "duodenal", "gastric",
                "cfVaricesOther", "abnlLab", "portalHTN", "histoCirrhosis", "portalVeinThrombosis", 
                "EvidenceOther", "hisAlcohol", "autoimmuneHep", "bilAtresia", "cryptogenic", "cf", "hepB",
                "hepC", "nash", "pbc", "psc", "etiologyOther", "cfAbPain", "cfBowelHab", "cfConst", 
                "cfDiarr", "cfGISx", "cfWeightLoss", "cfOtherSx", "cfCDifficileColits", "cfCrohnsDisease", 
                "cfGraftHostDisease", "cfInfectiousColitis", "cfIschemicColitis", "cfRadiationColitis", 
                "cfUlcerativeColitis", "cfOtherNonMalDiagnosis", "cfAblationOfAVM", "cfDecompression", 
                "cfHemorrhoidalBanding", "cfPolypectomy", "cfStent", "cfOtherIntervention", "cfAnemia", 
                "cfLowFerritin", "cfFOBT", "cfHematochezia", "cfMelena", "cfOtherGIBLoodLoss", 
                "cfAbnormalXray", "cfScreeningAvg", "cfFamHistColCancer", "cfFamHistPolyps", 
                "cfHistOFBreastCancer", "cfAdPolyps", "cfColRecCancer", "cfIndCrohnsDisease", 
                "cfIndUlcerativeColitis", "cfFamAdPolyposis", "cfHerColCancer", "cfIndOtherSuspectedMal", 
                "nbIndAgeOfDx", "nbOverNoHours", "cfTimeout", "cfAttendingPresent" , "cfMonBloodPress", 
                "cfMonECG", "cfMonPulseOximetry", "cfMonSuppOxygen", "cfMonOther", "cfPreprocAntibiotics", 
                "cfOtherSedMedOther", "cfNoSedMed", "cfNoSedMed", "cfPatientIntubated", "cfProcColonoscopy", 
                "cfProcIleoscopy", "cfProcScreeningLowRisk", "cfProcScreeningHigh", "cfProcOther",
                "cfProcIncompPrep", "cfProcObstruction", "cfProcDiscomfort", "cfProcPatUnstable", 
                "cfProcStricture", "cfProcIncompOther", "nbProcDurCecumMin", "nbProcDurCecumSec", 
                "nbProcDurScopeMin", "nbProcDurScopeSec", "cfColFindAVM", "cfColFindDivert", 
                "cfColFindDivert", "cfColFindNormal"});
            VSplit vsp = new VSplit("proc_data", "proc_text", toSplitTinyInt);
            c.Add(vsp);

            VMerge vm20 = new VMerge("proc_data", "IndOtherSuspectedMal");
            c.Add(vm20);

            VMerge vm19 = new VMerge("proc_data", "IndicationsSxOther");
            c.Add(vm19);

            VMerge vm18 = new VMerge("proc_data", "IndicationsStent");
            c.Add(vm18);

            VMerge vm17 = new VMerge("proc_data", "IndicationsOtherIntervention");
            c.Add(vm17);

            VMerge vm16 = new VMerge("proc_data", "IndicationsOtherDiagnosis");
            c.Add(vm16);

            VMerge vm15 = new VMerge("proc_data", "IndicationsOtherBloodLoss");
            c.Add(vm15);

            VMerge vm14 = new VMerge("proc_data", "IndicationsHematochezia");
            c.Add(vm14);

            VMerge vm13 = new VMerge("proc_data", "IndicationsFOBT");
            c.Add(vm13);

            VMerge vm12 = new VMerge("proc_data", "IndicationsFamHistPolyps");
            c.Add(vm12);

            VMerge vm11 = new VMerge("proc_data", "IndicationsFamHistCancer");
            c.Add(vm11);

            VMerge vm10 = new VMerge("proc_data", "IndicationsDiarrhea");
            c.Add(vm10);

            VMerge vm9 = new VMerge("proc_data", "IndicationsConstipation");
            c.Add(vm9);
            
            VMerge vm8 = new VMerge("proc_data", "IndicationsColRecCancer");
            c.Add(vm8);

            VMerge vm7 = new VMerge("proc_data", "IndicationsAnemia");
            c.Add(vm7);
            VMerge vm6 = new VMerge("proc_data", "IndicationsAdPolyps");
            c.Add(vm6);

            VMerge vm5 = new VMerge("proc_data", "IndicationsAbnormalXray");
            c.Add(vm5);

            VMerge vm4 = new VMerge("proc_data", "EvidenceOther");
            c.Add(vm4);

            VMerge vm3 = new VMerge("proc_data", "PreProcAntibiotics");
            c.Add(vm3);

            VMerge vm2 = new VMerge("proc_data", "MedicalHistory");
            c.Add(vm2);

            VMerge vm = new VMerge("proc_data", "SurgicalHistory");
            c.Add(vm);

            List<string> toMerge = new List<string>();
            toMerge.Add("EGD");
            toMerge.Add("COL");
            HMerge h = new HMerge(toMerge, "proc_data", "procType");
            c.Add(h);

            //return c;
            return new Channel();

        }
    }
}
